package com.office.meetingManage.meetroom.controller;


import com.office.meetingManage.meetroom.pojo.OaReservationmeetroom;
import com.office.meetingManage.meetroom.pojo.otherPojo.MeetingParam;
import com.office.meetingManage.meetroom.service.ReservationmeetroomService;
import com.office.personalOffice.contacts.pojo.TbStaff;
import com.office.util.ExcelUtilXlsx;
import com.office.util.PageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;


/**
 * @Auther: 许月
 * @Date: 2022/10/29/15:34
 */
@RestController
@RequestMapping("/reservationmeetroom")
public class ReservationmeetroomController {

    @Autowired
    private ReservationmeetroomService reservationmeetroomService;


    /**
     * 添加会议
     * @param reservationmeetroom
     * @return
     */
    @RequestMapping("/addmeeting")
    public Boolean addMeeting( @RequestBody OaReservationmeetroom reservationmeetroom){
        /*System.out.println("********************************************");
        System.out.println(reservationmeetroom);*/

        Boolean flag = false;
        if(reservationmeetroom != null && !"".equals(reservationmeetroom)){
            flag =   reservationmeetroomService.addMeeting(reservationmeetroom);
        }
        return flag;
    }

    /**
     * 查询
     * @param meetingParam
     * @param pageModel
     * @return
     */
    @RequestMapping("/list")
    public PageModel<OaReservationmeetroom> getList(MeetingParam meetingParam,PageModel<OaReservationmeetroom> pageModel){
        System.out.println("***********************************************************");
        System.out.println("前端传来的数据"+meetingParam);
        System.out.println(pageModel.getPageNum());
        System.out.println("***********************************************************");
        pageModel = reservationmeetroomService.getList(meetingParam, pageModel);
        return pageModel;
    }

    /**
     * 审批会议
     * @param reservationmeetroom
     * @return
     */
    @RequestMapping("/approval")
    public Boolean approval( @RequestBody OaReservationmeetroom reservationmeetroom){
        /*System.out.println("********************************************");
        System.out.println(reservationmeetroom);*/

        Boolean flag = false;
        if(reservationmeetroom != null && !"".equals(reservationmeetroom)){
            flag =   reservationmeetroomService.approval(reservationmeetroom);
        }
        return flag;
    }

    /**
     * 删除会议
     * @param rid
     * @return
     */
    @RequestMapping("/delete/{rid}")
    public Boolean deleteById(@PathVariable("rid") Integer rid){

        System.out.println("*********************"+rid+"*********************");
        Boolean flag = false;
        if(rid != null && !"".equals(rid)){
            flag =   reservationmeetroomService.deleteMeeting(rid);
        }
        return flag;
    }

}
